package main

import (
	"context"
	"flag"
	"fmt"
	"jinse/logic"
	"os"

	"jinse/common/handlers/conf"
	"jinse/common/handlers/log"
	"jinse/common/server/grpcserv"

	// "jinse/common/handlers/mysql"
	// "jinse/common/handlers/redis"

	"team.wphr.vip/technology-group/infrastructure/trace"
)

var (
	confPath string
)

func init() {
	flag.StringVar(&confPath, "c", "./conf/app.dev.toml", "-c set config file path") // default config file is conf/app.toml
	flag.Parse()
	fmt.Printf("confPath is %s\n", confPath)

	conf.InitConf(confPath)
	log.Init()

	// mysql.Init()
	// redis.Init()

	go func() {
		logic.ExampleLogicInstance.RunTask()
	}()
}

func main() {
	// 启动服务
	if err := grpcserv.Run(); err != nil {
		log.Trace.Fatalf(context.Background(), trace.DLTagUndefined, "grpcserver Run err %v \n", err)
		os.Exit(1)
	}
}
